<extend name="Public/Common/base.html" />
<block name="main">


 <form class="layui-form" action="{$url}" method="post" >
 <input type="hidden" name="id" value='{$groupname["id"]}' />
 <div class="am-g">
	 <div class="am-panel am-panel-default">
	    <div class="am-panel-hd">给{$groupname['title']}授权&nbsp;&nbsp;&nbsp;&nbsp;
	    全选&nbsp;<input type="checkbox" id="all"/>
	    </div>	
		 <volist name="rulelist" id="vo">			  
			   <div class="am-u-sm-3 am-u-end">
				   <dl>			   
					   <dd><input type="checkbox"  name="rules[]" value="{$vo['id']}" />&nbsp;{$vo.title}</dd>			    
				   </dl>
			   </div>
	 	</volist>			  
		</div>   
   </div> 
   <button type="submit" class="am-btn am-btn-success {$status}">更新</button>
</form>

<js href="__PUBLIC__/assets/js/jquery14.js" />


<script type="text/javascript"> 
$(function() { 
$("#all").click(function() { 
 var flag = $(this).attr("checked"); 					
  $("[name=rules[]]:checkbox").each(function(){
	  $(this).attr("checked", flag);
	  });
});	 
});	
var ruleID="{$ruleid[0]['rules']}";
var arr=ruleID.split(',');
$("input[name='rules[]']").each(function(){			
	if($.inArray(this.value,arr)>=0){		
		 $(this).attr("checked","true"); 
		
	}
});

</script> 
    
</block>
